// import "./styles/default.scss";
// import "./styles/dark.scss";

let storageName = "themeName"
let defaultName = "light"

import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const theme = new Vuex.Store({
  state: {
		name: uni.getStorageSync(storageName) || defaultName,
  },
	getters: {
		currentName: (state) => {
			let name = state.name
			
		 //  uni.setNavigationBarColor({
			// 	frontColor: '#ffffff',
			// 	backgroundColor: '#ff0000',
			// })
			
			return name
		}
	},
  mutations: {
    "light" (state) {
			let name = "light"
      state.name = name
			 uni.setStorageSync(storageName,name)
    },
		"dark" (state) {
			let name = "dark"
		  state.name = name
			uni.setStorageSync(storageName,name)
			
		}
  },
	actions: {
	    setTheme ({commit},name) {
	      commit(name)
	    }
	  }
	
})

Vue.prototype.$theme = theme
export default theme

